<template>
  <!-- <div class="page-box"> -->

  <!-- 只有待审核状态的才有 -->
  <div class="screen_fixed  fwNo">
    <div style=" background: #fff; padding: 10px 0px;border-top: 1px solid #f8fbff" class="maxWidth">
      <van-button @click="exmApproval_audit(2)" class="cursor" style="width:40%" type="danger">驳回</van-button>
      <van-button @click="exmApproval_audit(1)" class="cursor" style="width:40%" type="primary">通过</van-button>
    </div>
  </div>
  <!-- </div> -->
</template>

<script>
import service from "@/api";
export default {
  props: {
    query: {
      type: Object,
      default: () => {}
    },
    message: {
      type: String,
      default: () => ""
    }
  },
  methods: {
    // 审核操作
    async exmApproval_audit(status) {
      if (!this.message) {
        this.$toast.fail("请填写备注");
        return;
      }
      const alertRes = await this.$alert(
        `此操作将进行审批${status == 1 ? "通过" : "驳回"}`
      );
      if (!alertRes) {
        return;
      }
      let subData = {
        recordId: this.query.recordId,
        status: status,
        approve_status: status,
        moduleId: this.query.id,
        message: this.message
      };
      this.$store.state.loading = true;
      this.$store.state.loadingText = "提交数据中";
      const { success = false } = await service.exmApproval_audit(subData);
      this.$store.state.loading = false;
      if (success) {
        this.$toast.success("提交成功");
        this.$goBack();
      }
    }
  }
};
</script>
<style scoped>
@import "./../../../components/public.css";
</style>